<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <HEAD>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <TITLE> 定位计划 </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>

 <input type="text" id="pointer1"/>
 <input type="text" id="pointer2"/>
 <input type="text" id="pointer3"/>
 <input type="text" id="pointer4"/>
 <input type="text" id="pointer5"/>
 <input type="text" id="pointer6"/>
 <button onclick="changeText()">Change</button>
 <div id="outPut"></div>
  
 </BODY>
 <script type="text/javascript">
 /**
 * 时间处理
 * 以yyyyMMdd的格式返回当前时间
 */
 Date.prototype.yyyyMMddHHmmSS = function() {
   var yyyy = this.getFullYear().toString();
   var MM = (this.getMonth()+1).toString();
   var dd  = this.getDate().toString();
   var HH = this.getHours().toString();
   var mm = this.getMinutes().toString();
   var SS = this.getSeconds().toString();

   return yyyy + (MM[1]?MM:"0"+MM[0]) + (dd[1]?dd:"0"+dd[0])+(HH[1]?HH:"0"+HH[0]) + (mm[1]?mm:"0"+mm[0])+ (SS[1]?SS:"0"+SS[0]); // padding
 };

 var transNum = Math.round(10000*Math.random());

 var changeText = function (){
	var doc = document;
	var inputs = doc.getElementsByTagName("input");

	var strs = null;
	var pointers = new Array();
	var interval = 2;
	var date = new Date();
	for(var i = 0,j = 0; i < inputs.length; i++) {
		if(inputs[i].value != null && inputs[i].value != "") {
			strs = inputs[i].value.split(", ");
			date.setMinutes(date.getMinutes() + interval);
			pointers[j++] = "00E"+Number(strs[1]).toFixed(6)+"N"+Number(strs[0]).toFixed(6)+"T"+date.yyyyMMddHHmmSS();
		}
	}

	var newStr = pointers.join("!")+"!";

	var outPutStr = "["+date.yyyyMMddHHmmSS()+transNum+++",T16,"+newStr.length+","+newStr+"]";
	doc.getElementById("outPut").innerHTML = outPutStr;
};
 </script>
</HTML>
